package com.example.dyxeapplication.content.menu.alfabet.eye;

import com.example.dyxeapplication.R;
import com.example.dyxeapplication.content.menu.alfabet.Alfabet;
import com.example.dyxeapplication.content.menu.alfabet.ear.Ear;
import com.example.dyxeapplication.content.menu.alfabet.hand.Hands;
import com.example.dyxeapplication.content.menu.alfabet.lips.Lips;
import com.example.dyxeapplication.menu.Menu;
import com.example.dyxeapplication.setting.temp;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.VideoView;

public class Eye extends Activity {
	private MediaPlayer mp;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.eye);

		Button eye = (Button) findViewById(R.id.iconeye);
		Button hand = (Button) findViewById(R.id.iconhand);
		Button ear = (Button) findViewById(R.id.iconear);
		Button lips = (Button) findViewById(R.id.iconlips);
		
		VideoView video = (VideoView) findViewById(R.id.vidviewEye);


		//Log.d("video array", "zz "+ video.getId());
		
		if (temp.huruf.equals("a")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoa));

		} else if (temp.huruf.equals("b")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videob));

		} else if (temp.huruf.equals("c")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoc));

		} else if (temp.huruf.equals("d")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videod));

		} else if (temp.huruf.equals("e")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoe));

		} else if (temp.huruf.equals("f")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videof));

		} else if (temp.huruf.equals("g")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videog));

		} else if (temp.huruf.equals("h")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoh));

		} else if (temp.huruf.equals("i")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoi));

		} else if (temp.huruf.equals("j")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoj));

		} else if (temp.huruf.equals("k")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videok));

		} else if (temp.huruf.equals("l")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videol));

		} else if (temp.huruf.equals("m")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videom));

		} else if (temp.huruf.equals("n")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videon));

		} else if (temp.huruf.equals("o")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoo));

		} else if (temp.huruf.equals("p")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videop));

		} else if (temp.huruf.equals("q")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoq));

		} else if (temp.huruf.equals("r")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videor));

		} else if (temp.huruf.equals("s")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videos));

		} else if (temp.huruf.equals("t")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videot));

		} else if (temp.huruf.equals("u")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videou));

		} else if (temp.huruf.equals("v")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videov));

		} else if (temp.huruf.equals("w")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videow));

		} else if (temp.huruf.equals("x")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videox));

		} else if (temp.huruf.equals("y")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoy));

		} else if (temp.huruf.equals("z")) {
			video.setVideoURI(Uri.parse("android.resource://"
					+ getPackageName() + "/" + R.raw.videoz));

		}

		video.setMediaController(new MediaController(this));
		video.requestFocus();
		video.start();
		

		eye.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent i = new Intent(Eye.this, Eye.class);
				i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(i);
			}
		});
		
		hand.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent i = new Intent(Eye.this, Hands.class);
				i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(i);
			}
		});
		
		ear.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent i = new Intent(Eye.this, Ear.class);
				i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(i);
			}
		});
		
		lips.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent i = new Intent(Eye.this, Lips.class);
				i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(i);
			}
		});

	}

	@Override
	public void onBackPressed() {
		Intent myIntent = new Intent(this, Alfabet.class);
		myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(myIntent);
	}

	public void home(View v) {
		Intent myIntent = new Intent(this, Menu.class);
		myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(myIntent);
	}
	
	@Override
	public void onDestroy() {
		super.onDestroy();
		// Release the MediaPlayer if going into background
		if (mp != null)
			mp.release();
	}
}